package com.cdream.basic.algorithm.leetcode.findElement;

import java.util.Arrays;

/**
 * @author cdream
 * @date 5/22/21
 */
public class Question242 {
    public static void main(String[] args) {
        new Question242().isAnagram("12", "12");
    }

    public boolean isAnagram(String s, String t) {
        if (s.length() != t.length()) {
            return false;
        }
        int[] ints = new int[26];
        for (int i = 0; i < s.length(); i++) {
            ints[s.charAt(i) - 'a']++;
            ints[t.charAt(i) - 'a']--;
        }
        return Arrays.equals(ints,new int[26]);
    }
}
